﻿// owner 蒋家伟

#pragma once

#ifndef MODELBASE_HOME
#error ModelBase内部专用宏
#else
#include "UnitTestUtils.h"
#define UNIT_TEST_DBG_WARN(DESCRIPTION, NAME, DATE) \
        jsdk::UnitTestUtils::showUnitTest(__FILE__, __FUNCTION__, __LINE__, NAME, DATE, DESCRIPTION); 

#define UNIT_TEST_DBG_WARN_UNLESS(CONDITION, DESCRIPTION, NAME, DATE) \
    if(!(CONDITION))\
    {\
        jsdk::UnitTestUtils::showAbnormalUnitTest(__FILE__, __FUNCTION__, __LINE__, NAME, DATE, DESCRIPTION);\
    }

#define UNIT_TEST_DBG_WARN_AND_RETURN_UNLESS(CONDITION, RETURN_RESULT, DESCRIPTION, NAME, DATE) \
    if(!(CONDITION))\
    {\
        jsdk::UnitTestUtils::showAbnormalUnitTest(__FILE__, __FUNCTION__, __LINE__, NAME, DATE, DESCRIPTION);\
        return RETURN_RESULT;\
    }

#define UNIT_TEST_DBG_WARN_AND_RETURN_NULLPTR_UNLESS(CONDITION, DESCRIPTION, NAME, DATE) \
    if(!(CONDITION))\
    {\
        jsdk::UnitTestUtils::showAbnormalUnitTest(__FILE__, __FUNCTION__, __LINE__, NAME, DATE, DESCRIPTION);\
        return nullptr;\
    }

#define UNIT_TEST_DBG_WARN_AND_RETURN_FALSE_UNLESS(CONDITION, DESCRIPTION, NAME, DATE) \
    if(!(CONDITION))\
    {\
        jsdk::UnitTestUtils::showAbnormalUnitTest(__FILE__, __FUNCTION__, __LINE__, NAME, DATE, DESCRIPTION);\
        return false;\
    }

#define UNIT_TEST_DBG_WARN_AND_RETURN_VOID_UNLESS(CONDITION, DESCRIPTION, NAME, DATE) \
    if(!(CONDITION))\
    {\
        jsdk::UnitTestUtils::showAbnormalUnitTest(__FILE__, __FUNCTION__, __LINE__, NAME, DATE, DESCRIPTION);\
        return;\
    }

#define UNIT_TEST_DBG_WARN_AND_CONTINUE_UNLESS(CONDITION, DESCRIPTION, NAME, DATE) \
    if(!(CONDITION))\
    {\
        jsdk::UnitTestUtils::showAbnormalUnitTest(__FILE__, __FUNCTION__, __LINE__, NAME, DATE, DESCRIPTION);\
        continue;\
    }
#endif
